<template lang="html">
  <div class="main-page" id="store-page">
    <!-- 标题 -->
    <!-- <van-nav-bar class="main-header" title="商学院" :left-arrow="true" :fixed="true" :z-index="11" @click-left="onClickLeft"/> -->
    <nav-bar title="消息中心"  @goBack="onClickLeft"/>

    <!-- 主体内容 -->
    <div class="main-content has-header-space">
      <div class="message_center">
        <div class="message_item_list">
          <!-- <navigator hover-class='none' url="../../../pages/member/message_center/message_list/message_list?type=1"> -->
            <div class="message_item">
              <router-link :to="{ path: '/merber/message/item/1', params: {} }">
                <div class="msg_item_icon">
                  <img src="https://mjmh.meijiameihuo.com/wechat/images/common/msg/msg_1.png" class="message_item_img" />
                  <div class="hot" v-if="msg_list.xitong.message_is_read === 0"></div>
                </div>
                <div class="message_item_info">
                  <span class="message_item_info_title">系统消息</span>
                  <span class="msg_des">{{msg_list.xitong ? msg_list.xitong.message_content : '暂无消息'}}</span>
                </div>
                <div class="time_txt">{{msg_list.xitong.message_time}}</div>
              </router-link>
            </div>
          <!-- </navigator> -->
          <router-link :to="{ path: '/merber/message/item/2', params: {} }">
            <div class="message_item">
              <div class="msg_item_icon">
                <img src="https://mjmh.meijiameihuo.com/wechat/images/common/msg/msg_2.png" class="message_item_img" />
                <div class="hot" v-if="msg_list.good_product.message_is_read === 0"></div>
              </div>
              <div class="message_item_info">
                <span class="message_item_info_title">好货推荐</span>
                <span class="msg_des">{{msg_list.good_product.title}}</span>
              </div>
              <div class="time_txt">1小时前</div>
            </div>
          </router-link>
          <!-- <navigator hover-class='none' url="../../pages/message_center/message_list/message_list?type=3">
            <div class="message_item">
              <div class="msg_item_icon">
                <img src="https://mjmh.meijiameihuo.com/wechat/images/common/msg/msg_3.png" class="message_item_img" />
                <div class="hot"></div>
              </div>
              <div class="message_item_info">
                <span class="message_item_info_title">物流信息</span>
                <span class="msg_des">系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒系统升级提醒</span>
              </div>
              <div class="time_txt">1小时前</div>
            </div>
          </navigator> -->
          <!-- <navigator hover-class='none' url="../../../pages/member/message_center/message_list/message_list?type=4"> -->
            <div class="message_item no_border">
              <router-link :to="{ path: '/merber/message/item/4', params: {} }">
              <div class="msg_item_icon">
                <img src="https://mjmh.meijiameihuo.com/wechat/images/common/msg/msg_4.png" class="message_item_img" />
                <div class="hot" v-if="msg_list.yonhjin.message_is_read === 0"></div>
              </div>
              <div class="message_item_info no_hr">
                <span class="message_item_info_title">返利奖励</span>
                <span class="msg_des">{{msg_list.yonhjin ? msg_list.yonhjin.message_content : '暂无消息'}}</span>
              </div>
              <div class="time_txt">{{msg_list.yonhjin.message_time}}</div>
              </router-link>
            </div>
          <!-- </navigator> -->
          <div class="bank"></div>
          <!-- 系统客服 -->
          <!-- <div class="message_item no_border kefu" v-if="sys_service_message.user_id"> -->
            <!-- <navigator hover-class='none' url="../../../pages/member/message_center/customer_service/customer_service?merchant_id={{item.user_id}}&&source=sys"> -->
              <!-- <div class="msg_item_icon">
                <img v-bind:src="sys_service_message.user_avatar" class="message_item_img" />
              </div>
              <div class="message_item_info">
                <span class="message_item_info_title">{{sys_service_message.user_nickname}}</span>
                <span class="msg_des">{{sys_service_message.list.length ? sys_service_message.list[0].message_show_type === 'image' ? '[图片]' : sys_service_message.list[0].message_content : ''}}</span>
              </div>
              <div class="time_txt" v-if="sys_service_message.message_time">{{sys_service_message.message_time}}</div>
              <div class="hot" v-if="sys_service_message.total">{{sys_service_message.total > 99 ? '99+' : sys_service_message.total}}</div> -->
            <!-- </navigator> -->
          <!-- </div> -->
          <!-- 商户客服 -->
          <!-- <div class="message_item no_border kefu" v-for="(item, key) in service_message" v-bind:key="key">
            <navigator hover-class='none' url="../../../pages/member/message_center/customer_service/customer_service?merchant_id={{item.merchant_code}}">
              <div class="msg_item_icon">
                <img v-bind:src="item.user_avatar" class="message_item_img" />
              </div>
              <div class="message_item_info">
                <span class="message_item_info_title">{{item.merchant_name}}</span>
                <span class="msg_des">{{item.result ? item.result.message_show_type === 'image' ? '[图片]' : item.result.message_show_type === 'product' ? '[产品]' : item.result.message_show_type === 'order' ? '[订单]' :item.result.message_content : ''}}</span>
              </div>
              <div class="time_txt" v-if="item.message_time">{{item.message_time}}</div>
              <div class="hot" v-if="item.total">{{item.total > 99? '99+' : item.total}}</div>
            </navigator>
          </div> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from '@/components/global/nav-bar.vue'
export default {
  components: { NavBar },
  data () {
    return {
      details: {},
      msg_list: {
        xitong: [],
        yonhjin: [],
        good_product: {}
      }
    }
  },
  created () {
    this.getDetalis()
  },
  mounted () {
    // 将backToday方法绑定到window下面，提供给外部调用
    window['getUpload'] = () => {
      this.getDetalis()
    }
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    getDetalis () {
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'user_message_group', method: 'get' }).then((resp) => { // 请求成功
          if (resp.return_code === '0000') {
            this.msg_list = resp.data
          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }

  }
}
</script>
